﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using hse_2013_photo_viewer;

namespace TestProject2
{
    [TestClass]
    public class PhotoBrowsingTesting
    {
        [TestMethod]
        public void ReverseTesting()
        {
            PhotoBrowsing PB = new PhotoBrowsing();

            Assert.AreEqual("321", PhotoBrowsing.Reverse("123"));
        }
        [TestMethod]
        public void AllFilesIncluded()
        {
            string path = "C:\\";

            List<string> testpaths = Directory.GetFiles(path, "*.jpg*").ToList();
            testpaths.AddRange(Directory.GetFiles(path, "*.gif*").ToList());
            testpaths.AddRange(Directory.GetFiles(path, "*.bmp*").ToList());

            PhotoBrowsing PB = new PhotoBrowsing();
            Assert.AreEqual(testpaths.Count, PB.LoadPictures(path).Count);

           
        }
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void ExceptionIfNullPath()
        {
            string path = "";

            PhotoBrowsing PB = new PhotoBrowsing();
            PB.LoadPictures(path);
            
        }
        [TestMethod]
        public void ArraysNotEqual()
        {
            string path = "C:\\";

            List<string> testpaths = Directory.GetFiles(path, "*.jpg*").ToList();
            testpaths.AddRange(Directory.GetFiles(path, "*.gif*").ToList());
            testpaths.AddRange(Directory.GetFiles(path, "*.bmp*").ToList());

            PhotoBrowsing PB = new PhotoBrowsing();
            Assert.AreNotEqual(testpaths, PB.LoadPictures(path));
            
        }

        [TestMethod]
        public void ArraysAreSame()
        {
            string path = "C:\\";

            List<string> testpaths = Directory.GetFiles(path, "*.jpg*").ToList();
            testpaths.AddRange(Directory.GetFiles(path, "*.gif*").ToList());
            testpaths.AddRange(Directory.GetFiles(path, "*.bmp*").ToList());

            PhotoBrowsing PB = new PhotoBrowsing();
            Assert.AreNotSame(testpaths, PB.LoadPictures(path));

        }

    }
}
